package com.ctgu.controller;


import com.ctgu.common.ResponseResult;
import com.ctgu.model.entity.JobWanted;
import com.ctgu.service.IJobWantedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yiMa
 * @since 2023-07-05
 */
@RestController
@RequestMapping("/job-wanted")
public class JobWantedController {

    @Autowired
    private IJobWantedService jobWantedService;

    @PostMapping("/add")
    @PreAuthorize("@AYM.hasAuthority('jobWanted:one:add')")
    public ResponseResult add(@RequestBody JobWanted jobWanted){
        return jobWantedService.add(jobWanted);
    }
    @GetMapping("/page")
    public ResponseResult listPage(Integer page,Integer pageSize,String jobPosition){
        return jobWantedService.ListPage(page,pageSize,jobPosition);
    }

    @DeleteMapping("/delete")
    @PreAuthorize("@AYM.hasAuthority('jobWanted:one:delete')")
    public ResponseResult delete(@RequestBody Integer[] ids){
        return jobWantedService.delete(ids);
    }
    @GetMapping("/myPage")
    @PreAuthorize("@AYM.hasAuthority('jobWanted:info:my')")
    public ResponseResult my_page(int page,int pageSize){
        return jobWantedService.getMyPage(page,pageSize);
    }
}

